﻿//-----------------------------------------------------------------------
// <copyright file="IFCISPlusServer.cs" company="FCIS">
//     Company copyright tag.
// </copyright>
// <author>Ramy Medhat</author>
// <date>24/8/2011</date>
// <reviewer></reviewer>
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FCISPlus.Server.Database;

namespace FCISPlus.Server.Backend
{
    /// <summary>
    /// FCIS+ Server Interface
    /// </summary>
    internal interface IFCISPlusServer
    {
        /// <summary>
        /// Checks the login.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <returns>Boolean indicating the success of login.</returns>
        bool CheckLogin(string username, string password);

        /// <summary>
        /// Gets the user.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <returns>Gets the user object.</returns>
        User GetUser(string username);

        /// <summary>
        /// Creates the user.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <returns>The created user object.</returns>
        User CreateUser(string username, string password);

        /// <summary>
        /// Updates the profile.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="age">The age.</param>
        /// <param name="interests">The interests.</param>
        void UpdateProfile(User user, int age, string interests);

        /// <summary>
        /// Gets the friends.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns>Array of friends.</returns>
        User[] GetFriends(User user);

        /// <summary>
        /// Adds the friend to user.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="friend">The friend.</param>
        void AddFriendToUser(User user, User friend);

        /// <summary>
        /// Gets all users.
        /// </summary>
        /// <returns>List of users.</returns>
        Database.User[] GetAllUsers();

        /// <summary>
        /// Removes the friend from user.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="friend">The friend.</param>
        void RemoveFriendFromUser(User user, User friend);

        /// <summary>
        /// Gets the user feeds.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns>Array of posts.</returns>
        Post[] GetUserFeeds(User user);

        /// <summary>
        /// Adds the post.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="postText">The post text.</param>
        /// <param name="postLink">The post link.</param>
        void AddPost(User user, string postText, string postLink);

        /// <summary>
        /// Adds the comment.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="post">The post.</param>
        /// <param name="comment">The comment.</param>
        void AddComment(User user, Post post, string comment);

        /// <summary>
        /// Likes the specified post.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="post">The post.</param>
        void Like(User user, Post post);

        /// <summary>
        /// Unlikes the specified post.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="post">The post.</param>
        void Unlike(User user, Post post);

        /// <summary>
        /// Sends the message.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="friend">The friend.</param>
        /// <param name="messageText">The message text.</param>
        void SendMessage(User user, User friend, string messageText);

        /// <summary>
        /// Gets the recent conversations.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="messageLifeTime">The message life time.</param>
        /// <returns></returns>
        Message[] GetRecentConversations(User user, TimeSpan messageLifeTime);

        /// <summary>
        /// Gets the conversation by friend.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="friend">The friend.</param>
        /// <param name="messageLifeTime">The message life time.</param>
        /// <returns></returns>
        Message[] GetConversationByFriend(User user,User friend, TimeSpan messageLifeTime);

    }
}
